<?php 
include_once(''.P.'/public/header.html');
?>

<script type="text/javascript" src="res/bootstrapplugin/jquery-bootstable.js"></script>
<script type="text/javascript" src="res/menu/jquery-rockmenu.js"></script>
<link rel="stylesheet" type="text/css" href="res/menu/jquery-rockmenu.css">

<script type="text/javascript" src="res/ztree/js/jquery.ztree.all.min.js"></script>
<link rel="stylesheet" type="text/css" href="res/ztree/css/metroStyle/metroStyle.css">


<script>

function initbody(){
	
	table = $('#viewshow').bootstable({
		url:'index.php?m=users&a=data',method:'get',celleditor:true,tablename:'1',
		cellurl:'index.php',fanye:true,cellurl:'index.php?m=index&a=savecell',
		columns:[{
			text:'头像',dataIndex:'face',renderer:function(v){
				if(!v)v='images/noface.png';
				v='<img src="'+v+'" onclick="js.viewimg(this)" width="30">';
				return v;
			}
		},{
			text:'名称',dataIndex:'name'
		},{
			text:'用户名',dataIndex:'user'
		},{
			text:'部门',dataIndex:'deptname'
		},{
			text:'手机号',dataIndex:'mobile'
		},{
			text:'邮箱',dataIndex:'email'
		},{
			text:'类型',dataIndex:'type',sortable:true,renderer:function(v){
				if(v=='0')v='普通用户';
				if(v=='1')v='管理员';
				if(v=='2')v='客服人员';
				return v;
			}
		},{
			text:'职位',dataIndex:'ranking',editor:true
		},{
			text:'状态',dataIndex:'status',sortable:true,type:'checkbox',editor:true,editorbefore:function(d){
				if(d.id==adminid){
					return false;
				}else{
					return true;
				}
			}
		},{
			text:'排序号',dataIndex:'sort',sortable:true,type:'number',editor:true
		},{
			text:'ID',dataIndex:'id'
		},{
			text:'',dataIndex:'opts',align:'left',renderer:function(s,d){
				var str = '<a class="zhu" href="?m=users&a=form&id='+d.id+'">编辑</a>&nbsp;';
				if(d.id!=adminid)str+='<a class="zhu" href="javascript:;" onclick="deleterecord('+d.id+',1,false)">删</a>';
				return str;
			}
		}],
		beforeload:function(){
			
		},
		itemclick:function(){
			
		}
	});
	
	var setting = {
		view:{
			showLine:false
		},
		callback:{
			onClick:function(e,node,tid){
				table.setparams({deptid:node.id}, true);
			}
		}
	};
	var zNodes = <?=json_encode($deptdata)?>;
	$.fn.zTree.init($("#treedept"), setting, zNodes);
}

</script>
</head>

<body>

<?php 
include_once(''.P.'/public/top.html');
?>

<div align="center">

<div style="width:<?=$maxwidth?>;margin:20px 0px" align="left">
	<div style="color:#cccccc">
		<a href="?m=manage" class="zhu"><?=lang('admin.home')?></a> &gt;
		<a href="" class="zhu"><?=lang('admin.usertitle')?></a>
	</div>
	<div class="mainbody">
	
	
	
	<table width="100%">
	<tr valign="top">
	<td style="background:#f9f9f9;min-height:500px;border-right:1px #f1f1f1 solid">
	<div style="width:220px;min-height:500px;">
		<div style="padding:10px;background-color:#f1f1f1"><b>部门列表</b></div>
		<div>
		
		<ul id="treedept" class="ztree"></ul>
		</div>
		

	</div>
	</td>
	
	<td width="90%">
	
		<div style="padding:10px;background-color:#f1f1f1"><b>用户列表</b> <a class="webbtn" style="border-radius:5px" href="?m=users&a=form&id=0">新增</a></div>
		
		<div style="padding:10px">
		
			<div id="viewshow"></div>
		</div>
	
	
	</td>
	</tr>	
	</table>
		
	

	
		
	</div>
</div>



<?php 
include_once(''.P.'/public/footer.html');
?>
</div>

</body>
</html>